<!DOCTYPE html>
<html lang="cn-zh">

<head>
  

  
  


  <meta charset="utf-8">


  <meta name="robots" content="noindex, nofollow, noarchive">


<meta name="viewport" content="width=device-width, initial-scale=1.0">


  
    
      <meta name="description" content="开发的乐趣在于相通而不同">
    
  


<meta name="color-scheme" content="light dark">







<meta name="generator" content="Hugo 0.111.2">

<meta content="" name="keywords">
<meta content="通通不同-博客" property="og:title">
<meta content="开发的乐趣在于相通而不同" property="og:description">

<meta name="msvalidate.01" content="F56ED94B7E86941E3DACEF208F07D329" />

  <title>
    
    通通不同-博客
    
</title>

  <link rel="canonical" href="https://codebeautiful.gitee.io/">


  <link rel="alternate" type="application/rss+xml" href="/index.xml" title="通通不同-博客">

  








  

  
    
    
    
      
      
    
    
    
  
    
    
    
      
      
    
    
    
  
    
    
    
      
      
    
    
    
  
    
    
    
      
      
    
    
    
  
    
    
    
      
      
    
    
    
  
    
    
    
      
      
    
    
    
  
    
    
    
      
      
    
    
    
  
    
    
    
      
      
    
    
    
  
    
    
    
      
      
    
    
    
  
    
    
    
      
      
    
    
    
  


  
  <link rel="stylesheet" href="/css/base.min.4f231885947d13c748c815d93da49f07ab89afb67629f9970b7c054610e88e0b.css" integrity="sha256-TyMYhZR9E8dIyBXZPaSfB6uJr7Z2KfmXC3wFRhDojgs=" crossorigin="anonymous">



</head>

<body>
  <nav class="u-background">
  <div class="u-wrapper">
    <ul class="Banner">
      <li class="Banner-item Banner-item--title">
        <h1 class="Banner-heading">
          <a class="Banner-link u-clickable" href="/">通通不同-博客</a>
        </h1>
      </li>
      
        <li class="Banner-item">
          <a class="Banner-link u-clickable" href="/post/">全部</a>
        </li>
      
        <li class="Banner-item">
          <a class="Banner-link u-clickable" href="/categories/">分类</a>
        </li>
      
        <li class="Banner-item">
          <a class="Banner-link u-clickable" href="/tags/">标签</a>
        </li>
      
        <li class="Banner-item">
          <a class="Banner-link u-clickable" href="/about/">关于</a>
        </li>
      
    </ul>
  </div>
</nav>

  <main>
    <div class="u-wrapper">
      <div class="u-padding">
        

  
    <article>
      <header class="Heading">
  <h2 class="Heading-title">
    <a class="Heading-link u-clickable" href="/post/golang_response_body_close/" rel="bookmark">GO http请求完成后需要关闭response.Body.Close()</a>
  </h2>
  
    <time datetime="2023-04-19T00:43:08&#43;08:00">19 April, 2023</time>
  
</header>

      
        
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-go" data-lang="go"><span style="display:flex;"><span><span style="color:#a6e22e">resp</span>, <span style="color:#a6e22e">err</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">http</span>.<span style="color:#a6e22e">Post</span>(<span style="color:#a6e22e">url</span>, <span style="color:#e6db74">&#34;application/json&#34;</span>, <span style="color:#66d9ef">nil</span>)
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span> <span style="color:#a6e22e">err</span> <span style="color:#f92672">!=</span> <span style="color:#66d9ef">nil</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> <span style="color:#a6e22e">err</span>
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">defer</span> <span style="color:#66d9ef">func</span>(<span style="color:#a6e22e">body</span> <span style="color:#a6e22e">io</span>.<span style="color:#a6e22e">ReadCloser</span>) {
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">body</span> <span style="color:#f92672">!=</span> <span style="color:#66d9ef">nil</span> {
</span></span><span style="display:flex;"><span>        <span style="color:#a6e22e">err</span> <span style="color:#f92672">:=</span> <span style="color:#a6e22e">body</span>.<span style="color:#a6e22e">Close</span>()
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">if</span> <span style="color:#a6e22e">err</span> <span style="color:#f92672">!=</span> <span style="color:#66d9ef">nil</span> {
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>        }
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>}(<span style="color:#a6e22e">response</span>.<span style="color:#a6e22e">Body</span>)</span></span></code></pre></div>

      
      


  

  

  





  <footer>
    
      
    
      
    
      
        <ul class="Tags">
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/go/" rel="tag">go</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/http/" rel="tag">http</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/body/" rel="tag">body</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/%E5%85%B3%E9%97%AD/" rel="tag">关闭</a>
            </li>
          
        </ul>
      
    
  </footer>

    </article>
    
      <div class="Divider"></div>
    
  
    <article>
      <header class="Heading">
  <h2 class="Heading-title">
    <a class="Heading-link u-clickable" href="/post/mac_book_use_routes/" rel="bookmark">MacBook当做无线或有线路由器使用</a>
  </h2>
  
    <time datetime="2023-04-14T22:44:55&#43;08:00">14 April, 2023</time>
  
</header>

      
        <p><strong>需求问题</strong></p>
<p>客户服务器需要安装软件，但是服务器无法连接互联网，怎么搞。</p>
<ol>
<li>买一台无线随身热点，需要有带网线接口，无线5G WiFi路由器</li>
<li>手里有一台MacBook电脑和有网口的扩展坞，是否可以搞一个无线的WiFi路由器</li>
</ol>
<p>先决调节：Mac笔记本作为无线路由器（需要一个带网口的扩展坞）</p>
<h4 id="macbook通过wifi连接互联网">
  <a class="Heading-link u-clickable" href="/post/mac_book_use_routes/#macbook%e9%80%9a%e8%bf%87wifi%e8%bf%9e%e6%8e%a5%e4%ba%92%e8%81%94%e7%bd%91">MacBook通过WiFi连接互联网</a>
</h4>
<p>配置互联网共享（系统设置-&gt;通用-&gt;共享）其中AX88179A是扩展坞的网口，配置好后点击完成，再开启互联网共享</p>
<p><img src="/images/MacBook_shareNetwork.png" alt="Pasted Graphic.png"></p>
<p>完成以上配置后，将待联网机器通过网线和扩展坞连接，设备就可以访问互联网了</p>
<h4 id="mac笔记本作为有线路由器通过网线接入互联网">
  <a class="Heading-link u-clickable" href="/post/mac_book_use_routes/#mac%e7%ac%94%e8%ae%b0%e6%9c%ac%e4%bd%9c%e4%b8%ba%e6%9c%89%e7%ba%bf%e8%b7%af%e7%94%b1%e5%99%a8%e9%80%9a%e8%bf%87%e7%bd%91%e7%ba%bf%e6%8e%a5%e5%85%a5%e4%ba%92%e8%81%94%e7%bd%91">Mac笔记本作为有线路由器通过网线接入互联网</a>
</h4>
<p>该方式和上面的相反，电脑以有线方式接入互联网</p>
<p>配置项如图所示，最后面会出现一个Wi-Fi选项，点击后，可以设置WiFi名称和密码，以供WiFi设备连接该热点，点击完成后，开启互联网共享</p>
<p><img src="/images/mac_book_use_routes/image-20230414225641422.png" alt="image-20230414225641422"></p>

      
      


  

  

  





  <footer>
    
      
    
      
    
      
        <ul class="Tags">
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/macbook/" rel="tag">MacBook</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/%E9%80%9A%E8%BF%87wifi%E8%BF%9E%E6%8E%A5%E4%BA%92%E8%81%94%E7%BD%91/" rel="tag">通过WiFi连接互联网</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/mac%E7%AC%94%E8%AE%B0%E6%9C%AC%E4%BD%9C%E4%B8%BA%E6%9C%89%E7%BA%BF%E8%B7%AF%E7%94%B1%E5%99%A8%E9%80%9A%E8%BF%87%E7%BD%91%E7%BA%BF%E6%8E%A5%E5%85%A5%E4%BA%92%E8%81%94%E7%BD%91/" rel="tag">Mac笔记本作为有线路由器通过网线接入互联网</a>
            </li>
          
        </ul>
      
    
  </footer>

    </article>
    
      <div class="Divider"></div>
    
  
    <article>
      <header class="Heading">
  <h2 class="Heading-title">
    <a class="Heading-link u-clickable" href="/post/go_vs_mysql_type/" rel="bookmark">GO vs MySQL类型对应关系</a>
  </h2>
  
    <time datetime="2023-04-14T15:30:01&#43;08:00">14 April, 2023</time>
  
</header>

      
        <table>
<thead>
<tr>
<th>golang</th>
<th>MySQL</th>
</tr>
</thead>
<tbody>
<tr>
<td>int,int32 添加auto或名称为Id时</td>
<td>integer AUTO_INCREMENT</td>
</tr>
<tr>
<td>int64</td>
<td>bigint AUTO_INCREMENT</td>
</tr>
<tr>
<td>uint,uint32</td>
<td>integer unsigned AUTO_INCREMENT</td>
</tr>
<tr>
<td>uint64</td>
<td>bigint unsigned AUTO_INCREMENT</td>
</tr>
<tr>
<td>bool</td>
<td>bool</td>
</tr>
<tr>
<td>string size 255</td>
<td>varchar(255)</td>
</tr>
<tr>
<td>string type(text)</td>
<td>longtext</td>
</tr>
<tr>
<td>time.Time type(data)</td>
<td>date</td>
</tr>
<tr>
<td>time.Time</td>
<td>datetime</td>
</tr>
<tr>
<td>byte</td>
<td>tinyint unsigned</td>
</tr>
<tr>
<td>rune</td>
<td>integer</td>
</tr>
<tr>
<td>int</td>
<td>integer</td>
</tr>
<tr>
<td>int8</td>
<td>tinyint</td>
</tr>
<tr>
<td>int16</td>
<td>smallint</td>
</tr>
<tr>
<td>int32</td>
<td>integer</td>
</tr>
<tr>
<td>int64</td>
<td>bigint</td>
</tr>
<tr>
<td>uint</td>
<td>integer unsigned</td>
</tr>
<tr>
<td>uint8</td>
<td>tinyint unsigned</td>
</tr>
<tr>
<td>uint16</td>
<td>smallint unsigned</td>
</tr>
<tr>
<td>uint32</td>
<td>integer unsigned</td>
</tr>
<tr>
<td>uint64</td>
<td>bigint unsigned</td>
</tr>
<tr>
<td>float32</td>
<td>double precision</td>
</tr>
<tr>
<td>float64</td>
<td>double precision</td>
</tr>
<tr>
<td>float64  digits,decimals</td>
<td>numeric(digits,decimals)</td>
</tr>
</tbody>
</table>

      
      


  

  

  





  <footer>
    
      
    
      
    
      
        <ul class="Tags">
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/go/" rel="tag">go</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/mysql/" rel="tag">MySQL</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/%E7%B1%BB%E5%9E%8B/" rel="tag">类型</a>
            </li>
          
        </ul>
      
    
  </footer>

    </article>
    
      <div class="Divider"></div>
    
  
    <article>
      <header class="Heading">
  <h2 class="Heading-title">
    <a class="Heading-link u-clickable" href="/post/android_ndk_missing_and_no_known_rule/" rel="bookmark">Android NDK 引入外部动态库.so报错 missing and no known rule</a>
  </h2>
  
    <time datetime="2023-04-01T07:08:32&#43;08:00">1 April, 2023</time>
  
</header>

      
        <h3 id="正确的配置项-cmake">
  <a class="Heading-link u-clickable" href="/post/android_ndk_missing_and_no_known_rule/#%e6%ad%a3%e7%a1%ae%e7%9a%84%e9%85%8d%e7%bd%ae%e9%a1%b9-cmake">正确的配置项-cmake</a>
</h3>

<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cmake" data-lang="cmake"><span style="display:flex;"><span>add_library( <span style="color:#e6db74">qtcore</span>
</span></span><span style="display:flex;"><span>              <span style="color:#e6db74">SHARED</span>
</span></span><span style="display:flex;"><span>              <span style="color:#e6db74">IMPORTED</span> )<span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span>set_target_properties( <span style="color:#75715e"># Specifies the target library.
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>              <span style="color:#e6db74">qtcore</span>
</span></span><span style="display:flex;"><span>              <span style="color:#75715e"># Specifies the parameter you want to define.
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>              <span style="color:#e6db74">PROPERTIES</span> <span style="color:#e6db74">IMPORTED_LOCATION</span>
</span></span><span style="display:flex;"><span>              <span style="color:#75715e"># 关键点在这里，这个路径必须为绝对路径，报错原因是因为使用了相对路径
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>              <span style="color:#f92672">${</span>PROJECT_SOURCE_DIR<span style="color:#f92672">}</span><span style="color:#e6db74">/../libs/</span><span style="color:#f92672">${</span>ANDROID_ABI<span style="color:#f92672">}</span><span style="color:#e6db74">/libQt6Core.so</span> )<span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span>target_link_libraries( <span style="color:#75715e"># Specifies the target library.
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>              <span style="color:#e6db74">shared</span>
</span></span><span style="display:flex;"><span>              <span style="color:#e6db74">qtcore</span>
</span></span><span style="display:flex;"><span>              <span style="color:#75715e"># Links the target library to the log library
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>              <span style="color:#75715e"># included in the NDK.
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>              <span style="color:#f92672">${</span>log-lib<span style="color:#f92672">}</span>)</span></span></code></pre></div>
<ul>
<li>关键点在这里，这个路径必须为绝对路径，报错原因是因为使用了相对路径</li>
</ul>

      
      


  

  

  





  <footer>
    
      
    
      
    
      
        <ul class="Tags">
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/android/" rel="tag">Android</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/ndk/" rel="tag">NDK</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/qt/" rel="tag">Qt</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/cmake/" rel="tag">cmake</a>
            </li>
          
        </ul>
      
    
  </footer>

    </article>
    
      <div class="Divider"></div>
    
  
    <article>
      <header class="Heading">
  <h2 class="Heading-title">
    <a class="Heading-link u-clickable" href="/post/uinavigationcontroller_scrollview_whiten/" rel="bookmark">解决UINavigationController 滑动UIScrollView出现白边问题</a>
  </h2>
  
    <time datetime="2023-03-31T15:18:50&#43;08:00">31 March, 2023</time>
  
</header>

      
        <h3 id="问题描述">
  <a class="Heading-link u-clickable" href="/post/uinavigationcontroller_scrollview_whiten/#%e9%97%ae%e9%a2%98%e6%8f%8f%e8%bf%b0">问题描述</a>
</h3>
<blockquote>
<p>开发过程中出现ScrollView滑动会会使NavigationBar出现白边问题</p>
</blockquote>
<ul>
<li>正常情况
<img src="/images/UINavigationWhiten1.png" alt="正常情况"></li>
<li>异常情况
<img src="/images/UINavigationWhiten2.png" alt="正常情况"></li>
</ul>
<h3 id="解决方法">
  <a class="Heading-link u-clickable" href="/post/uinavigationcontroller_scrollview_whiten/#%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95">解决方法</a>
</h3>
<blockquote>
<p>在iOS13版本之后添加以下代码可以解决该问题，代码放到第一个UIControllerView的viewDidLoad方法中</p>
</blockquote>

<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-swift" data-lang="swift"><span style="display:flex;"><span><span style="color:#66d9ef">if</span> <span style="color:#75715e">#available</span>(<span style="color:#75715e">iOS</span> <span style="color:#ae81ff">13.0</span>, <span style="color:#f92672">*</span>) {
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">let</span> apperance = UINavigationBarAppearance()
</span></span><span style="display:flex;"><span>  apperance.backgroundColor = UIColor.black
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">self</span>.navigationController?.navigationBar.standardAppearance = apperance
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>

      
      


  

  

  





    </article>
    
      <div class="Divider"></div>
    
  
    <article>
      <header class="Heading">
  <h2 class="Heading-title">
    <a class="Heading-link u-clickable" href="/post/storyboard_uinavigation_back_cancel/" rel="bookmark">iOS开发取消UINavigationController返回按钮的问题和自定义按钮颜色</a>
  </h2>
  
    <time datetime="2023-03-31T14:20:40&#43;08:00">31 March, 2023</time>
  
</header>

      
        <ul>
<li>
<p>如图修改BackButton属性值给一个空格回车
<img src="/images/UINavigationItem1.png" alt="设置Back按钮"></p>
</li>
<li>
<p>接下来会发现Navigation Item下会有一个新的控件出现，如图
<img src="/images/UINavigationItem2.png" alt="设置按钮颜色"></p>
</li>
<li>
<p>选中该组件Bar Button Item，修改相关属性值
其中Tint属性就是修改按钮颜色值</p>
</li>
</ul>

      
      


  

  

  





  <footer>
    
      
    
      
    
      
        <ul class="Tags">
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/ios/" rel="tag">iOS</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/uinavigationcontroller/" rel="tag">UINavigationController</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/%E8%87%AA%E5%AE%9A%E4%B9%89%E6%8C%89%E9%92%AE%E9%A2%9C%E8%89%B2/" rel="tag">自定义按钮颜色</a>
            </li>
          
        </ul>
      
    
  </footer>

    </article>
    
      <div class="Divider"></div>
    
  
    <article>
      <header class="Heading">
  <h2 class="Heading-title">
    <a class="Heading-link u-clickable" href="/post/swift_available/" rel="bookmark">swift 使用 @available 或 #available</a>
  </h2>
  
    <time datetime="2023-03-30T17:06:01&#43;08:00">30 March, 2023</time>
  
</header>

      
        
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-swift" data-lang="swift"><span style="display:flex;"><span><span style="color:#66d9ef">if</span> <span style="color:#75715e">#available</span>(<span style="color:#75715e">iOS</span> <span style="color:#ae81ff">14</span>, <span style="color:#f92672">*</span>) {
</span></span><span style="display:flex;"><span>  print(<span style="color:#e6db74">&#34;This code only runs on iOS 14 and up&#34;</span>)
</span></span><span style="display:flex;"><span>} <span style="color:#66d9ef">else</span> {
</span></span><span style="display:flex;"><span>  print(<span style="color:#e6db74">&#34;This code only runs on iOS 13 and lower&#34;</span>)
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>
<p>在 guard 语句中使用 available 属性：</p>

<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-swift" data-lang="swift"><span style="display:flex;"><span><span style="color:#66d9ef">guard</span> <span style="color:#75715e">#available</span>(<span style="color:#75715e">iOS</span> <span style="color:#ae81ff">14</span>, <span style="color:#f92672">*</span>) <span style="color:#66d9ef">else</span> {
</span></span><span style="display:flex;"><span>  print(<span style="color:#e6db74">&#34;Returning if iOS 13 or lower&#34;</span>)
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">return</span>
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>
<h2 id="available和available之间的区别">
  <a class="Heading-link u-clickable" href="/post/swift_available/#available%e5%92%8cavailable%e4%b9%8b%e9%97%b4%e7%9a%84%e5%8c%ba%e5%88%ab">@available和#available之间的区别</a>
</h2>
<p>@available: 用于标记类或方法的可用性</p>
<p>#available: 用于仅针对特定平台或版本执行一段代码</p>

<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-swift" data-lang="swift"><span style="display:flex;"><span>@available(iOS <span style="color:#ae81ff">15</span>, <span style="color:#f92672">*</span>)
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">class</span> <span style="color:#a6e22e">App</span> {}
</span></span><span style="display:flex;"><span>@available(iOS <span style="color:#ae81ff">15</span>, <span style="color:#f92672">*</span>)
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">func</span> <span style="color:#a6e22e">app</span>() {}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span> <span style="color:#75715e">#available</span>(<span style="color:#75715e">iOS</span> <span style="color:#ae81ff">15</span>, <span style="color:#f92672">*</span>) {
</span></span><span style="display:flex;"><span>  
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>

      
      


  

  

  





    </article>
    
      <div class="Divider"></div>
    
  
    <article>
      <header class="Heading">
  <h2 class="Heading-title">
    <a class="Heading-link u-clickable" href="/post/swift_tableview_delete_style/" rel="bookmark">Swift 自定义UITableView左滑删除样式</a>
  </h2>
  
    <time datetime="2023-03-30T16:44:09&#43;08:00">30 March, 2023</time>
  
</header>

      
        
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-swift" data-lang="swift"><span style="display:flex;"><span>@available(iOS <span style="color:#ae81ff">11</span>, <span style="color:#f92672">*</span>)
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">func</span> <span style="color:#a6e22e">tableView</span>(<span style="color:#66d9ef">_</span> tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -&gt; UISwipeActionsConfiguration? {
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">let</span> deleteRowAction = UIContextualAction.<span style="color:#66d9ef">init</span>(style: UIContextualAction.Style.destructive, title: <span style="color:#e6db74">&#34;DELETE&#34;</span>) {(action: UIContextualAction , sourceView: UIView, completionHandle: (Bool) -&gt; Void) <span style="color:#66d9ef">in</span>
</span></span><span style="display:flex;"><span>    my_log(<span style="color:#e6db74">&#34;delete click&#34;</span>)
</span></span><span style="display:flex;"><span>  }
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  deleteRowAction.image = UIImage(named: <span style="color:#e6db74">&#34;delete&#34;</span>)
</span></span><span style="display:flex;"><span>  deleteRowAction.backgroundColor = UIColor(hexString: <span style="color:#e6db74">&#34;FE9B02&#34;</span>)
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">let</span> config = UISwipeActionsConfiguration.<span style="color:#66d9ef">init</span>(actions: [deleteRowAction])
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">return</span> config
</span></span><span style="display:flex;"><span>}</span></span></code></pre></div>

      
      


  

  

  





    </article>
    
      <div class="Divider"></div>
    
  
    <article>
      <header class="Heading">
  <h2 class="Heading-title">
    <a class="Heading-link u-clickable" href="/post/platform_define/" rel="bookmark">各个平台的内置宏定义</a>
  </h2>
  
    <time datetime="2023-03-28T19:24:03&#43;08:00">28 March, 2023</time>
  
</header>

      
        <h3 id="windows">
  <a class="Heading-link u-clickable" href="/post/platform_define/#windows">Windows</a>
</h3>
<ul>
<li>WIN32、_WIN32、<em>WIN32</em>、WIN64、_WIN64、<em>WIN64</em></li>
</ul>
<h3 id="android">
  <a class="Heading-link u-clickable" href="/post/platform_define/#android">Android</a>
</h3>
<ul>
<li>ANDROID、<code>__ANDROID__</code></li>
</ul>
<h3 id="linux">
  <a class="Heading-link u-clickable" href="/post/platform_define/#linux">Linux</a>
</h3>
<ul>
<li><code>__linux__</code></li>
</ul>
<h3 id="iosmac">
  <a class="Heading-link u-clickable" href="/post/platform_define/#iosmac">iOS/Mac</a>
</h3>
<ul>
<li><code>__APPLE__</code>、TARGET_OS_IPHONE、TARGET_IPHONE_SIMULATOR、TARGET_OS_MAC</li>
</ul>
<h2 id="代码判断">
  <a class="Heading-link u-clickable" href="/post/platform_define/#%e4%bb%a3%e7%a0%81%e5%88%a4%e6%96%ad">代码判断</a>
</h2>

<pre tabindex="0"><code>#if defined(WIN32) || defined(_WIN32) || defined(_WIN32_) || defined(WIN64) || defined(_WIN64) || defined(_WIN64_)
#define OS_WINDOWS       1
#elif defined(ANDROID) || defined(__ANDROID__)
#define OS_ANDROID       1
#elif defined(__linux__)
#define OS_LINUX	         1
#elif defined(__APPLE__) || defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR) || defined(TARGET_OS_MAC)
#define OS_IOS           1
#else
#define OS_UNKNOWN 1
#endif</code></pre>

      
      


  

  

  





  <footer>
    
      
    
      
    
      
        <ul class="Tags">
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/c/" rel="tag">c</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/%E7%B3%BB%E7%BB%9F%E5%88%A4%E5%AE%9A/" rel="tag">系统判定</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/android/" rel="tag">Android</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/windows/" rel="tag">Windows</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/linux/" rel="tag">linux</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/ios/" rel="tag">iOS</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/osx/" rel="tag">OSX</a>
            </li>
          
        </ul>
      
    
  </footer>

    </article>
    
      <div class="Divider"></div>
    
  
    <article>
      <header class="Heading">
  <h2 class="Heading-title">
    <a class="Heading-link u-clickable" href="/post/program_data_directory/" rel="bookmark">桌面软件数据存放路径</a>
  </h2>
  
    <time datetime="2023-03-22T22:39:52&#43;08:00">22 March, 2023</time>
  
</header>

      
        <h2 id="windows下程序数据存放目录">
  <a class="Heading-link u-clickable" href="/post/program_data_directory/#windows%e4%b8%8b%e7%a8%8b%e5%ba%8f%e6%95%b0%e6%8d%ae%e5%ad%98%e6%94%be%e7%9b%ae%e5%bd%95">windows下程序数据存放目录</a>
</h2>
<blockquote>
<p>C:\Users\用户名\AppData \Roaming,
通过环境变量%AppData%可以访问,这里用来存放当前登录用户所产生的数据，
对其他的用户不可见。如果你在公司网络,加入了域,这个文件夹会通过网路同步，
让你的数据在不同的计算机上漫游。该目录常被滥用。</p>
</blockquote>
<blockquote>
<p>C:\Users\用户名\AppData \Local,
通过环境变量%LocalAppData%可以访问，
这个目录和上面的基本- -样,不过仅限本地,加入了域也不会同步。
-般情况下，如果不加入域，Roaming和Local并没有什么区别，
但是需要网络同步的时候,尽量把不必要的数据留在本地。
个人使用的软件可以装在C:\Users\用户名\AppData\Local/\Programs下面。</p>
</blockquote>
<blockquote>
<p>C:\ProgramData,
和AppData的区别在于,这里存放的数据是公用的,
如果你希望软件的数据在所有的用户之间保持一致,
那么程序生成的数据应当存放在这里。</p>
</blockquote>
<h2 id="macos-app程序数据存放目录">
  <a class="Heading-link u-clickable" href="/post/program_data_directory/#macos-app%e7%a8%8b%e5%ba%8f%e6%95%b0%e6%8d%ae%e5%ad%98%e6%94%be%e7%9b%ae%e5%bd%95">macOS App程序数据存放目录</a>
</h2>
<blockquote>
<p>/Users/用户名/Library/Application Support</p>
</blockquote>

      
      


  

  

  





  <footer>
    
      
    
      
    
      
        <ul class="Tags">
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/%E8%BD%AF%E4%BB%B6%E5%AD%98%E6%94%BE%E7%9B%AE%E5%BD%95/" rel="tag">软件存放目录</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/windows/" rel="tag">Windows</a>
            </li>
          
            <li class="Tags-item u-background">
              <a class="Tags-link u-clickable" href="/tags/macos/" rel="tag">macOS</a>
            </li>
          
        </ul>
      
    
  </footer>

    </article>
    
      <div class="Divider"></div>
    
  

  
  <nav>
    
      <a class="Pagination u-clickable" href="/page/3/" rel="prev">« Previous</a>
    
    
      <a class="Pagination Pagination--right u-clickable" href="/" rel="next">Next »</a>
    
  </nav>




      </div>
    </div>
  </main>
  
  <footer class="Footer">
    <div class="u-wrapper">
      <div class="u-padding">
        开发的乐趣在于相通而不同
      </div>
    </div>
  </footer>


  <script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?d08a2ad355cb7a065a41be081b43297e";
  var s = document.getElementsByTagName("script")[0];
  s.parentNode.insertBefore(hm, s);
})();
</script>

</body>

</html>
